package com.zhuidian.mothernote.fragment;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.base.decoration.LinearLayoutDecoration;
import com.base.listener.ItemClickListener;
import com.base.presenter.BasePresenter;
import com.zhuidian.mothernote.R;
import com.zhuidian.mothernote.activity.RedDevelopsDetailActivity;
import com.zhuidian.mothernote.adapter.AnswerAndEarnRedDevelopAdapter;
import com.zhuidian.mothernote.global.BaseFragment;
import com.zhuidian.mothernote.presenter.AnswerAndEarnRedDevelopPresenter;

public class AnswerAndEarnRedDevelopFragment extends BaseFragment<AnswerAndEarnRedDevelopPresenter> {

    private AnswerAndEarnRedDevelopPresenter answerAndEarnRedDevelopPresenter;
    private RecyclerView recyclerView;
    private ImageView iv_red_develop;
    private AnswerAndEarnRedDevelopAdapter adapter;

    @Override
    protected int inflateMainLayoutId() {
        return R.layout.fragment_answer_and_red_develop;
    }

    @SuppressLint("WrongConstant")
    @Override
    protected void initView(View view) {
        recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
        iv_red_develop = (ImageView) view.findViewById(R.id.iv_red_develop);
        recyclerView.setHasFixedSize(true);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.addItemDecoration(new LinearLayoutDecoration(context));
        adapter = new AnswerAndEarnRedDevelopAdapter(context);
        adapter.setOnClickListener(this);
        adapter.setItemClickListener(new ItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {

            }
        });
        recyclerView.setAdapter(adapter);

    }

    @Override
    protected void setListener() {
         iv_red_develop.setOnClickListener(this);
    }

    @Override
    protected void initValue() {

    }

    @Override
    protected BasePresenter getPresenter() {
        answerAndEarnRedDevelopPresenter = new AnswerAndEarnRedDevelopPresenter();
        return answerAndEarnRedDevelopPresenter;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_red_develop:
                      context.startActivity(new Intent(context, RedDevelopsDetailActivity.class));
                break;
        }
    }
}
